﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HCQ2_Model
{
    public class WordSenseModel
    {
        public int ws_id { get; set; }
        [Required(ErrorMessage = "单词必填")]
        public string word { get; set; }
        [Required(ErrorMessage = "国际音标必填")]
        public string gj_symbol { get; set; }
        public string kk_symbol { get; set; }
        public string cp_type { get; set; }
        public string china_mean { get; set; }
        public string ws_phrase { get; set; }
        public string example { get; set; }
        public string create_name { get; set; }
        public string create_date { get; set; }
        public string update_name { get; set; }
        public string update_date { get; set; }
        public string ws_note { get; set; }

        public T_VRWordSense ToEntry()
        {
            return new T_VRWordSense
            {
                ws_id = this.ws_id,
                word = this.word,
                gj_symbol = this.gj_symbol,
                kk_symbol = this.kk_symbol,
                cp_type = this.cp_type,
                china_mean = this.china_mean,
                ws_phrase = this.ws_phrase,
                example = this.example,
                create_name = this.create_name,
                create_date = DateTime.Now,
                update_name = this.update_name,
                update_date = DateTime.Now,
                ws_note = this.ws_note
            };
        }
    }
    public partial class T_VRWordSense
    {
        public WordSenseModel ToPOCO()
        {
            return new WordSenseModel
            {
                ws_id = this.ws_id,
                word = this.word,
                gj_symbol = this.gj_symbol,
                kk_symbol = this.kk_symbol,
                cp_type = this.cp_type,
                china_mean = this.china_mean,
                ws_phrase = this.ws_phrase,
                example = this.example,
                create_name = this.create_name,
                create_date = this.create_date.ToString("yyyy-MM-dd HH:mm"),
                update_name = this.update_name,
                update_date = this.update_date.ToString("yyyy-MM-dd HH:mm"),
                ws_note = this.ws_note
            };
        }
    }
}
